import { Column, Entity, ManyToOne } from 'typeorm'
import { ApiProperty } from '@nestjs/swagger'

import { BaseModelsWithUUIDPrimary, PostEntity, UserEntity } from './index'

/**
 * @package 商品评论
 * @author liu
 */
@Entity({ name: 'post_comment' })
export class PostCommentEntity extends BaseModelsWithUUIDPrimary {
  @Column({ comment: '评论' })
  content: string

  @ManyToOne(type => PostCommentEntity, post => post.parent)
  parent: PostCommentEntity

  @ManyToOne(type => UserEntity, user => user.postComment)
  user: UserEntity

  @ManyToOne(type => PostEntity, post => post.comments)
  post: PostEntity
}
